From: Keir Fraser Date: Sat, 27 Jun 2009 09:40:11 +0000 (+0100) Subject: tmem: extra stats X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13677^2~1 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=da5e66e536ce9a491d620d90584577c5b08c9a06;p=xen.git tmem: extra stats This patch collects a few additional valuable per-domain performance stats. Signed-off-by: Dan Magenheimer --- diff --git a/tools/misc/xen-tmem-list-parse.c b/tools/misc/xen-tmem-list-parse.c index 51ffe44fd2..da21434a94 100644 --- a/tools/misc/xen-tmem-list-parse.c +++ b/tools/misc/xen-tmem-list-parse.c @@ -174,12 +174,19 @@ void parse_client(char *s) unsigned long long compressed_sum_size = parse(s,"cb"); unsigned long long compress_poor = parse(s,"cn"); unsigned long long compress_nomem = parse(s,"cm"); + unsigned long long total_cycles = parse(s,"Tc"); + unsigned long long succ_eph_gets = parse(s,"Ge"); + unsigned long long succ_pers_puts = parse(s,"Pp"); + unsigned long long succ_pers_gets = parse(s,"Gp"); printf("domid%lu: weight=%lu,cap=%lu,compress=%d,frozen=%d," + "total_cycles=%llu,succ_eph_gets=%llu," + "succ_pers_puts=%llu,succ_pers_gets=%llu," "eph_count=%llu,max_eph=%llu," "compression ratio=%lu%% (samples=%llu,poor=%llu,nomem=%llu)\n", cli_id, weight, cap, compress?1:0, frozen?1:0, eph_count, max_eph_count, + total_cycles, succ_eph_gets, succ_pers_puts, succ_pers_gets, compressed_pages ? (long)((compressed_sum_size*100LL) / (compressed_pages*PAGE_SIZE)) : 0, compressed_pages, compress_poor, compress_nomem); diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 0ab1098ccc..09513ea40a 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -119,6 +119,8 @@ struct client { unsigned long compress_poor, compress_nomem; unsigned long compressed_pages; uint64_t compressed_sum_size; + uint64_t total_cycles; + unsigned long succ_pers_puts, succ_eph_gets, succ_pers_gets; }; typedef struct client client_t; @@ -842,6 +844,8 @@ static client_t *client_create(void) list_add_tail(&client->client_list, &global_client_list); INIT_LIST_HEAD(&client->ephemeral_page_list); client->eph_count = client->eph_count_max = 0; + client->total_cycles = 0; client->succ_pers_puts = 0; + client->succ_eph_gets = 0; client->succ_pers_gets = 0; printk("ok\n"); return client; } @@ -1081,6 +1085,8 @@ done: tmem_spin_unlock(&obj->obj_spinlock); pool->dup_puts_replaced++; pool->good_puts++; + if ( is_persistent(pool) ) + client->succ_pers_puts++; return 1; bad_copy: @@ -1208,6 +1214,8 @@ insert_page: obj->no_evict = 0; tmem_spin_unlock(&obj->obj_spinlock); pool->good_puts++; + if ( is_persistent(pool) ) + client->succ_pers_puts++; return 1; delete_and_free: @@ -1307,6 +1315,10 @@ static NOINLINE int do_tmem_get(pool_t *pool, uint64_t oid, uint32_t index, tmem_spin_unlock(&obj->obj_spinlock); } pool->found_gets++; + if ( is_ephemeral(pool) ) + client->succ_eph_gets++; + else + client->succ_pers_gets++; return 1; bad_copy: @@ -1539,9 +1551,11 @@ static int tmemc_list_client(client_t *c, tmem_cli_va_t buf, int off, pool_t *p; bool_t s; - n = scnprintf(info,BSIZE,"C=CI:%d,ww:%d,ca:%d,co:%d,fr:%d%c", - c->cli_id, c->weight, c->cap, c->compress, - c->frozen, use_long ? ',' : '\n'); + n = scnprintf(info,BSIZE,"C=CI:%d,ww:%d,ca:%d,co:%d,fr:%d," + "Tc:%"PRIu64",Ge:%ld,Pp:%ld,Gp:%ld%c", + c->cli_id, c->weight, c->cap, c->compress, c->frozen, + c->total_cycles, c->succ_eph_gets, c->succ_pers_puts, c->succ_pers_gets, + use_long ? ',' : '\n'); if (use_long) n += scnprintf(info+n,BSIZE-n, "Ec:%ld,Em:%ld,cp:%ld,cb:%"PRId64",cn:%ld,cm:%ld\n", @@ -1944,17 +1958,17 @@ out: if ( rc < 0 ) errored_tmem_ops++; if ( succ_get ) - END_CYC_COUNTER(succ_get); + END_CYC_COUNTER_CLI(succ_get,client); else if ( succ_put ) - END_CYC_COUNTER(succ_put); + END_CYC_COUNTER_CLI(succ_put,client); else if ( non_succ_get ) - END_CYC_COUNTER(non_succ_get); + END_CYC_COUNTER_CLI(non_succ_get,client); else if ( non_succ_put ) - END_CYC_COUNTER(non_succ_put); + END_CYC_COUNTER_CLI(non_succ_put,client); else if ( flush ) - END_CYC_COUNTER(flush); - else - END_CYC_COUNTER(flush_obj); + END_CYC_COUNTER_CLI(flush,client); + else if ( flush_obj ) + END_CYC_COUNTER_CLI(flush_obj,client); if ( tmh_lock_all ) { diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h index aec44ce09e..55d5f2152a 100644 --- a/xen/include/xen/tmem_xen.h +++ b/xen/include/xen/tmem_xen.h @@ -360,6 +360,16 @@ extern int tmh_copy_to_client(tmem_cli_mfn_t cmfn, pfp_t *pfp, if ((uint32_t)x##_start > x##_max_cycles) x##_max_cycles = x##_start; \ } \ } while (0) +#define END_CYC_COUNTER_CLI(x,y) \ + do { \ + x##_start = get_cycles() - x##_start; \ + if (x##_start > 0 && x##_start < 1000000000) { \ + x##_sum_cycles += x##_start; x##_count++; \ + if ((uint32_t)x##_start < x##_min_cycles) x##_min_cycles = x##_start; \ + if ((uint32_t)x##_start > x##_max_cycles) x##_max_cycles = x##_start; \ + y->total_cycles += x##_start; \ + } \ + } while (0) #define RESET_CYC_COUNTER(x) { x##_sum_cycles = 0, x##_count = 0; \ x##_min_cycles = 0x7fffffff, x##_max_cycles = 0; } #define SCNPRINTF_CYC_COUNTER(buf,size,x,tag) \